import 'package:flutter/material.dart';
import 'package:my_flutter_tool/util/app_util.dart';

///当前App的定制对话框背景
class AppDialog extends StatelessWidget {
  const AppDialog({
    Key key,
    this.child,
    this.padding,
    this.margin,
    this.bottom,
  }) : super(key: key);

  ///子控件
  final Widget child;

  ///内边距
  final EdgeInsetsGeometry padding;

  ///外边距
  final EdgeInsetsGeometry margin;

  ///显示在底部
  final bool bottom;

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Material(
          color: Colors.transparent,
          elevation: 0,
          child: Container(
            width: double.infinity,
            padding: padding ?? EdgeInsets.all(100.w),
            margin: margin ?? EdgeInsets.symmetric(horizontal: 100.w),
            child: child,
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(40.w),
            ),
          ),
        ),
      ],
    );
  }
}
